package pers.wensheng.patterns.behavioral_pattern.interpreter_pattern.entity;

import lombok.AllArgsConstructor;
import pers.wensheng.patterns.behavioral_pattern.interpreter_pattern.Context;

/**
 * 终结符表达式角色 变量表达式
 */
@AllArgsConstructor
public class Variable extends AbstractExpression {
    private String name;


    @Override
    public int interpret(Context ctx) {
        return ctx.getValue(this);
    }

    @Override
    public String toString() {
        return name;
    }
}
